Xbasic

Array touch Method

Syntax

V <array>.touch()

Description

Manually increment the array's changed counter.

Discussion

The <array>.touch() method increments an array's age semaphore. Arrays have transaction counters. When an array is modified, the transaction counter is incremented. However, property arrays cannot see changes inside array elements, therefore you must call <array>.touch() to force force the array to increment its transaction counter, or 'age'.

dim colors[3] as c 
colors[1] = "red"
colors[2] = "green"
colors[3] = "blue"
? colors.age()
= 3
colors[2] = "yellow"
? colors.age()
= 4


dim settings[3] as p
settings[1].color = "red"
settings[2].color = "green"
settings[3].color = "blue"
? settings.age()
= 0

settings[2].color = "yellow"
? settings.age()
= 0

settings.touch()
? settings.age()
= 1

The <array>.touch() method is used in tandem with the <array>.age() method to monitor and make updates to the user interface in an Xdialog. EG:

{watch=myarr.age()!refresh}

See Also